package com.rd.teacher.jichao.day15;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public class TestBlockingQueue {

    public static void main(String[] args) throws Exception{
        // 用数组实现的阻塞队列
        BlockingQueue<Integer> queue
                = new ArrayBlockingQueue<>(2);

        BlockingQueue<Integer> queue1
                = new ArrayBlockingQueue<>(Integer.MAX_VALUE);
        queue.put(1);
        queue.put(2);
//        queue.put(3);
        System.out.println(queue.size());
        System.out.println(queue);

        System.out.println(queue.take());
        System.out.println(queue.take());
//        System.out.println(queue.take());
        System.out.println(queue.size());
        System.out.println(queue);
    }
}
